/**
 * Created by xiao on 15/10/27.
 */

dwc.GX_Player = cc.Class.extend({
    ctor : function(){
    },
    GetToken : function() {return (this.m_sToken);},
    GetUid : function() { return (this.m_nUid); },
    GetLevel : function() { return (this.m_nLevel); },
    GetVIPLevel : function() { return (this.m_nVIPLevel); },
    GetNickName : function() { return (this.m_strNickName); },
    GetCurEXP : function() { return (this.m_nCurEXP); },
    GetCoin : function() { return (this.m_nCoin); },
    GetGem : function() { return (this.m_nGem); },
    GetCard : function() { return (this.m_nCard); },
    GetTotalDeposit : function() { return (this.m_nTotalDeposit); },
    GetSignName :function() {return (this.m_strSignName);},
    GetIP :function() {return (this.m_sIP);},

    GetAvatar: function() { return (this.m_avatar);},
    GetAvatarUrl: function() { return (this.m_avatarUrl);},
    GetSex: function () {return (this.m_sex);},
    GetAgent: function () {return (this.m_agent);},


    SetToken : function(__data) {this.m_sToken =  (this.m_sToken);},
    SetUid : function(__data) { this.m_nUid = (__data); },
    SetLevel : function(__data) { this.m_nLevel = (__data); },
    SetVIPLevel : function(__data) { this.m_nVIPLevel = (__data); },
    SetNickName : function(__data) { this.m_strNickName = (__data); },
    SetCurEXP : function(__data) { this.m_nCurEXP = (__data); },
    SetCoin : function(__data) { this.m_nCoin = (__data); if(this.m_nCoin < 0){this.m_nCoin = 0;} },
    SetGem : function(__data) { this.m_nGem = (__data); },
    SetCard : function(__data) { this.m_nCard = (__data); },
    SetTotalDeposit : function(__data) { this.m_nTotalDeposit = (__data); },

    SetIP : function(__data) { this.m_sIP = (__data); },
    SetSignName : function(__data){this.m_strSignName = (__data);},

    SetAvatar: function(__data) {this.m_avatar = (__data);},
    SetAvatarUrl: function(__data) {this.m_avatarUrl = (__data);},
    SetSex: function(__data) {this.m_sex = (__data);},
    SetAgent: function(__data) {this.m_agent = (__data);},

    m_sToken : "",
    m_nUid : 0,
    m_nLevel : 0,
    m_nVIPLevel : 0,
    m_strNickName : "",
    m_nCurEXP : 0,

    m_nCoin : 0,
    m_nGem : 0,
    m_nCard : 0,
    m_nTotalDeposit : 0,
    m_strSignName : "",
    m_sIP : "0.0.0.0",
    m_avatar : 0,
    m_avatarUrl : "",
    m_seat : 0,//座位编号
    m_sex:0,//0是男 1是女 2是保密
    m_agent: function(__data) {this.m_agent = (__data);},

});

dwc.Myself = {

    m_player : null,
    ctor : function(){
        this.myRoom = null;
    },
    InitData : function(__msg){
        var that = this;

        if (__msg){
            this.m_player = new dwc.GX_Player();

            var objUser = __msg.m_objUser;
            if(objUser.m_sNickName != undefined)
            {
                this.m_player.SetNickName(objUser.m_sNickName);
            }

            if(objUser.m_sSign != undefined)
            {
                this.m_player.SetSignName(objUser.m_sSign);
            }

            if(objUser.m_lUid != undefined)
            {
                this.m_player.SetUid(objUser.m_lUid);
            }

            if(objUser.m_lTotalCoin != undefined)
            {
                this.m_player.SetCoin(objUser.m_lTotalCoin);
            }
            if(objUser.m_lTotalGem != undefined)
            {
                this.m_player.SetGem(objUser.m_lTotalGem);
            }
            if(objUser.m_lTotalCard != undefined)
            {
                this.m_player.SetCard(objUser.m_lTotalCard);
            }
            if(objUser.m_lTotalDeposit != undefined)
            {
                this.m_player.SetCard(objUser.m_lTotalDeposit);
            }

            this.m_player.SetCurEXP(0);
            this.m_player.SetAgent(0);
            this.m_player.SetIP("0.0.0.0");
            this.m_player.SetAvatarUrl("");

            if(objUser.m_iAvatar)
            {
                this.m_player.SetAvatar(parseInt(objUser.m_iAvatar));
            }
            if(objUser.m_iSex != undefined)
            {
                this.m_player.SetSex(parseInt(objUser.m_iSex));
            }
            if(objUser.m_sIP != undefined)
            {
                this.m_player.SetIP(objUser.m_sIP);
            }
            if(objUser.m_lAgent != undefined)
            {
                this.m_player.SetAgent(parseInt(objUser.m_lAgent));
            }
        }
    },

    GetData : function(){
        return this.m_player;
    },

    myRoom : null,
    GetMyRoom : function(){
        return this.myRoom;
    },

    SetMyRoom : function(data){
        this.myRoom = data;
    },
    OnWebSocketMessage : function(__msg){

    },

};
